<?php
// +----------------------------------------------------------------------
// | my
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 http://baiyf.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: $this <498944516@qq.com>
// +----------------------------------------------------------------------
namespace app\rob\model;

use think\Model;

class RobNews extends Model
{

    protected $table = "my_rob_news";

    /**
     * 获取机器人
     * 
     */
    public function info($ids='',$data){
    	
       $list = $this->all($ids);

    		foreach($list as $key=>$new){
    			
                    $articles[]=[
        		            'Title' => $new->title,
        		            'Description' => $new->description,
        		            // 'PicUrl' => domain().get_cover($key?$new->picurl_big:$new->picurl, 'path'),
                            'PicUrl' =>'http://imga1.pic21.com/bizhi/131011/02186/s20.jpg',
        		            'Url' => $new->url
        		     ];
               
    		}

       return $articles;
      
    }

    public function editData(){

      $data=input("post.");
      if ( isset($data['file']) ) unset($data['file']);

      if ($data['id']){
         $res = $this->allowField(true)->where('id',$data['id'])->update($data);
      }else{
         $res = $this->allowField(true)->data($data)->save();
      }
      
      return $res;
    }

    
}